/* eslint-disable react-hooks/exhaustive-deps */
import { getChannel } from '@/store/actions/channel'
import { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'

/**
 * 获取频道列表
 * @returns 频道列表
 */
export default function useChannels () {
  const channels = useSelector((state) => state.channel)
  const dispatch = useDispatch()
  useEffect(() => {
    dispatch(getChannel())
  }, [])
  return channels
}
